﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;

namespace SoftWareBoot
{
    /// <summary>
    /// Page_Result.xaml 的交互逻辑
    /// </summary>
    public partial class Page_Result : Page
    {

        const string CONST_RESULT_OK = "项目文件升级更新成功！";
        const string CONST_RESULT_FAIL = "项目文件升级更新失败！";

        const string CONST_RESULT_OK_TXT = "请点击任意按钮关闭升级程序，程序将会立即启动项目程序。";

        const string CONST_RESULT_FAIL_TXT = "请点击重试按钮重新进行项目文件的升级更新操作，或点击其他任意按钮放弃本次升级更新，下一次启动系统的时候，将会自动提醒升级更新。";

        public Page_Result()
        {
            InitializeComponent();
        }

        public Page_Result(string ErrString)
        {
            InitializeComponent();

            SetDescription(ErrString);
        }

        private  void SetDescription(string ErrString)
        {
            if (ErrString != "")
            {
                Txt_Title.Text = CONST_RESULT_FAIL;
                Txt_Title.Foreground = System.Windows.Media.Brushes.Red;
                Txt_Description.Text = "失败原因：" + ErrString;
                Txt_Description.Visibility = System.Windows.Visibility.Visible;
                Txt_Info.Text = CONST_RESULT_FAIL_TXT;
            }
            else
            {
                Txt_Title.Text = CONST_RESULT_OK;
                Txt_Description.Visibility = System.Windows.Visibility.Collapsed;
                Txt_Info.Text = CONST_RESULT_OK_TXT;
            }
        
        }
    }
}
